<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Math对象</title>
</head>

<body>
    <script>
        //1.某一个数的多少次幂. 
        //console.log(Math.pow(2,3)); //2*2*2

        //2.四舍五入
        //    console.log(Math.round(1.6)); //2
        //    console.log(Math.round(1.4)); //1
        //    console.log(Math.round(1.5)); //2
        //    console.log(Math.round(1.46)); //1
        //    console.log(Math.round(1.499999999)); //1
        //    console.log(Math.round(1.500000001)); //2

        //3.ceil 向上取整 天花板函数
        // console.log(Math.ceil(1.6)); //2
        // console.log(Math.ceil(1.00000001)); //2
        // console.log(Math.ceil(1.99999991)); //2
        // console.log(Math.ceil(-1.99999991)); //-1

        //4.floor 向下取整 地板函数
        // console.log(Math.floor(1.6)); //1
        // console.log(Math.floor(1.00000001)); //1
        // console.log(Math.floor(1.99999991)); //1
        // console.log(Math.floor(-1.99999991)); //-2

        //5.求绝对值. 
        // console.log(Math.abs(5)); //5
        // console.log(Math.abs(-5));//5

        //6.求最大值
        //console.log(Math.max(10,11,55,44,22,-10,77,45));

        //7.求最小值
        //console.log(Math.min(10,11,55,44,22,-10,77,45));

        //8.求一个随机数. 
        // console.log(Math.random()); //  1 > 数 >= 0

        //0-100之间的整数
        //console.log(Math.floor(Math.random() * 100));

        //9.圆周率
        //console.log(Math.PI);

    </script>
</body>

</html>